<?php
include_once(dirname(__FILE__) . "/../../configure/configure.php");		//--> global var
include_once(dirname(__FILE__) . "/../configure/admin.config.inc.php");	//--> admin global var
include_once(dirname(__FILE__) . "/../tools/smarty/libs/Smarty.class.php");					//--> out template

include_once("impl/ImageImpl.php");
include_once("impl/ContentImpl.php");
include_once("impl/ContentGroupImpl.php");

include_once("impl/CategoryImpl.php");

require_once(dirname(__FILE__) . "/../controlHeader.php");					//--> system control header
require_once(dirname(__FILE__) . "/../controlOperate.php");				//-->
	
$contGimpl 	= new ContentGroupImpl(DB_TAG_MM);
$contImpl 	= new ContentImpl(DB_TAG_MM);

$oCatImpl 	= new CategoryImpl(DB_TAG_MM);

$error_message = '';

$order	= 'ORDER BY id DESC';

$oContentGroups = $contGimpl->getCustoms($where, $order, $page, DISPLAY_DATA_SIZE);
foreach($oContentGroups as $oContG){
	$catIds = $contGimpl->getCategoryIds($oContG->id);	
	$oContG->catName = $oCatImpl->getCategoryNames($catIds);
	
}


/*----- out html -----*/
$smarty = new Smarty();		//----- out template
$smarty->template_dir = TEMPLATE_SYS_DIR;
$smarty->compile_dir  = COMPILE_SYS_DIR;

$smarty->assign('error_message', $error_message);
$smarty->assign('menuGid', $menuGid);
$smarty->assign('menuid', $menuid);

$smarty->assign('selfFileName', $selfFileName);
$smarty->assign('arrOperateInfo', $arrOperateInfo);

$smarty->assign('arrDataList', $oContentGroups);
$smarty->assign('PAGE_BAR', $contGimpl->pagenav);

$smarty->assign('contGimpl', $contGimpl);


$smarty->display('listContentGroup.htm');
?>
